package com.zxy.lm.service.impl;

import com.zxy.lm.entity.Type;
import com.zxy.lm.mapper.TypeMapper;
import com.zxy.lm.service.TypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jiusi
 * @since 2021-06-22
 */
@Service
public class TypeServiceImpl extends ServiceImpl<TypeMapper, Type> implements TypeService {

    @Override
    public List<Type> queryAllType() {
        return baseMapper.selectList(null);
    }

    @Override
    public Map<Integer, String> queryMapAllType() {
        List<Type> typeList = queryAllType();
        HashMap<Integer, String> map = new HashMap<>();
        for (Type type : typeList) {
            map.put(type.getId(), type.getTypeName());
        }
        return map;
    }
}
